//
//  unittest3.c
//  tests the buyCard() function with random inputs
//
//  Created by Preston Skaggs on 1/23/14.
//
//

#include <stdio.h>
#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdlib.h>
#include <math.h>
#include <assert.h>

#define NUM_TESTS 2000

int main(){
    SelectStream(2);
    PlantSeeds(3);
    struct gameState *state = malloc(sizeof(struct gameState));
    int i, n, card, cardBought;
    enum CARD first = curse;
    enum CARD last = treasure_map;
    for(n=0; n<=NUM_TESTS; n++){
        for(i=0; i<sizeof(struct gameState); i++){
            ((char*)state)[i] = floor(Random() * 256);
        }
        card = (Random()*(last-first))+first;
        cardBought = buyCard(card, state);
        assert(cardBought == 0);
    }
    printf("Tests OK");
    return 0;
}